<script lang="ts" setup>
import { ArrowDown, UserFilled, SwitchButton } from '@element-plus/icons-vue'

const cls = 'ui-header'
</script>

<template>
  <div :class="cls">
    <div :class="`${cls}_title`">{{ $route.meta.fullTitle || $route.meta.title }}</div>
    <div class="spring"></div>
    <div :class="`${cls}_btns`">
      <img src="../../assets/imgs/top-refresh@2x.png" alt="refresh">
      <img src="../../assets/imgs/top-menu@2x.png" alt="menu">
      <img src="../../assets/imgs/top-notifs@2x.png" alt="notify">
    </div>
    <ElDropdown trigger="click">
      <div class="el-dropdown-link">
        <ElAvatar :size="32" :icon="UserFilled" style="margin-right: 10px;" />
        <span>管理者</span>
        <ElIcon class="el-icon--right">
          <ArrowDown />
        </ElIcon>
      </div>
      <template #dropdown>
        <ElDropdownMenu>
          <ElDropdownItem :icon="SwitchButton">退出</ElDropdownItem>
        </ElDropdownMenu>
      </template>
    </ElDropdown>
  </div>
</template>

<style lang="scss">
.ui-header {
  height: $header-height;
  padding: 0 $page-padding;
  display: flex;
  align-items: center;
  background-color: #fff;
  &_title {
    font-size: 14px;
    color: var(--el-text-color-primary);
  }
  &_btns {
    display: flex;
    align-items: center;
    margin-right: 20px;
    img {
      width: 24px;
      margin-left: 10px;
      cursor: pointer;
      transition: opacity .2s;
      &:hover {
        opacity: .7;
      }
    }
  }
  .el-dropdown-link {
    cursor: default;
    user-select: none;
  }
}
</style>
